package pers.xx.sbm.vo;

import pers.xx.sbm.enums.ResultEnum;

/**
 * @author ：xiexing
 * @description：json返回数据封装
 * @date ：2020/8/12 22:57
 */
public class ResResult<T> {

    private int code;//返回状态

    private String stateInfo;//返回提示信息

    private String optName;//接口操作名称

    private T data;//返回数据

    public ResResult() {
    }

    public ResResult(ResultEnum resultEnum, T data) {
        this.code = resultEnum.getState();
        this.stateInfo = resultEnum.getStateInfo();
        this.data = data;
    }

    public void setResult(ResultEnum resultEnum, T data) {
        this.code = resultEnum.getState();
        this.stateInfo = resultEnum.getStateInfo();
        this.data = data;
    }
    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getStateInfo() {
        return stateInfo;
    }

    public void setStateInfo(String stateInfo) {
        this.stateInfo = stateInfo;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }


    public String getOptName() {
        return optName;
    }

    public void setOptName(String optName) {
        this.optName = optName;
    }

    @Override
    public String toString() {
        return "ResResult{" +
                "code=" + code +
                ", stateInfo='" + stateInfo + '\'' +
                ", optName='" + optName + '\'' +
                ", data=" + data +
                '}';
    }
}
